public class test1 {
    public static void main(String[] args) {
        while(cur!=null){
            num=head;
            head=cur;
            cur=cur.next;
            head.next=num;
        }
    }
}
